using System;
using System.Collections.Generic;
using System.Text;
using Decav.Geography;

namespace Decav.Geocoding
{
    /// <summary>
    /// Gets the result of a geocode operation.
    /// </summary>
    public abstract class GeocodeResult
    {
        public GeocodeResult(LatLongPoint position, string city, string state, string postalCode)
        {
            _city = city;
            _state = state;
            _postalCode = postalCode;
            _position = position;
        }

        private LatLongPoint _position;

        /// <summary>
        /// Gets the latitude/longitude position of the address.
        /// </summary>
        public LatLongPoint Position
        {
            get
            {
                return _position;
            }
        }

        /// <summary>
        /// Gets the city the address resides in.
        /// </summary>
        public string City
        {
            get
            {
                return _city;
            }
        }

        /// <summary>
        /// Gets the state the address resides in.
        /// </summary>
        public string State
        {
            get
            {
                return _state;
            }
        }

        /// <summary>
        /// Gets the postal or zip ocde of the address.
        /// </summary>
        public string PostalCode
        {
            get
            {
                return _postalCode;
            }
        }

        private string _postalCode;
        private string _state;
        private string _city;

        public override string ToString()
        {
            return SecondLineToString();
        }

        /// <summary>
        /// Gets the city, state and zip as a string.
        /// </summary>
        /// <returns>The city, state and zip code as a string.</returns>
        protected string SecondLineToString()
        {
            return string.Format("{0}, {1} {2}", City, State, PostalCode);
        }
    }
}
